package de.baumann.browser.present.duobao

import de.baumann.browser.api.OdinObserver
import de.baumann.browser.api.net.vo.duobao.DuoBao
import de.baumann.browser.api.net.vo.duobao.DuoBaoOrder
import de.baumann.browser.base.BasePresenter
import de.baumann.browser.iview.duobao.IDuoBaoOrderView
import de.baumann.browser.model.processOrder
import de.baumann.browser.model.yiJieXiao

class DuoBaoOrderPresenter : BasePresenter<IDuoBaoOrderView>() {
    fun process() {
        processOrder()
                .subscribe(object : OdinObserver<List<DuoBao>>(view) {
                    override fun onSuccess(data: List<DuoBao>?) {
                        if (data != null)
                            view?.setProcessList(data)
                    }
                })
    }

    fun yiJieXiaoDingDan() {
        yiJieXiao()
                .subscribe(object : OdinObserver<List<DuoBaoOrder>>(view) {
                    override fun onSuccess(data: List<DuoBaoOrder>?) {
                        if (data != null)
                            view?.setList(data)
                    }
                })
    }
}